#!/usr/bin/env node

const https = require('https');
const url = require('url');
const addr = process.argv[2]|| 'https://sample.wangding.co/web/one-div.html';
const options = url.parse(global.encodeURI(addr));

options.headers = {
  'User-Agent':'01-my-curl.js'
}

https.get(addr,(res)=>{
  console.log(`HTTP/${res.httpVersion}
    ${res.statusCode}
    ${res.statusMessage}
    `);
  console.log(res.headers);
console.log(); 
res.pipe(process.stdout);
})
